<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>目标格式详情 - 模型转换适配</title>
<script src="https://cdn.tailwindcss.com/3.4.16"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/remixicon/4.6.0/remixicon.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#3b82f6',
secondary: '#64748b'
},
borderRadius: {
'none': '0px',
'sm': '4px',
DEFAULT: '8px',
'md': '12px',
'lg': '16px',
'xl': '20px',
'2xl': '24px',
'3xl': '32px',
'full': '9999px',
'button': '8px'
}
}
}
}
</script>
<style>
:where([class^="ri-"])::before { content: "\f3c2"; }
.format-card:hover {
transform: translateY(-4px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
transition: all 0.3s ease;
}
.comparison-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.tab-active {
color: #3b82f6;
border-bottom: 2px solid #3b82f6;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.custom-checkbox {
position: relative;
display: inline-block;
width: 18px;
height: 18px;
margin-right: 8px;
}
.custom-checkbox input {
opacity: 0;
width: 0;
height: 0;
}
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 18px;
width: 18px;
background-color: #fff;
border: 2px solid #d1d5db;
border-radius: 4px;
}
.custom-checkbox input:checked ~ .checkmark {
background-color: #3b82f6;
border-color: #3b82f6;
}
.checkmark:after {
content: "";
position: absolute;
display: none;
}
.custom-checkbox input:checked ~ .checkmark:after {
display: block;
}
.custom-checkbox .checkmark:after {
left: 5px;
top: 2px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
.code-block {
background: #1f2937;
color: #f9fafb;
font-family: 'Courier New', monospace;
font-size: 0.875rem;
line-height: 1.5;
padding: 1rem;
border-radius: 8px;
overflow-x: auto;
}
.copy-btn {
position: absolute;
top: 0.5rem;
right: 0.5rem;
background: rgba(255, 255, 255, 0.1);
color: #f9fafb;
border: 1px solid rgba(255, 255, 255, 0.2);
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
cursor: pointer;
transition: all 0.2s ease;
}
.copy-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="flex h-screen bg-gray-50">
<!-- 左侧菜单栏 -->
<aside class="w-64 bg-white shadow-sm">
<div class="p-4 border-b border-gray-100">
<h1 class="text-2xl font-['Pacifico'] text-primary">logo</h1>
</div>
<nav class="p-4">
<div class="space-y-4">
<!-- 模型管理 -->
<div>
<div class="flex items-center justify-between px-3 py-2 text-primary font-medium rounded-md bg-blue-50">
<div class="flex items-center">
<i class="ri-database-2-line mr-2"></i>
<span>模型管理</span>
</div>
<i class="ri-arrow-down-s-line"></i>
</div>
<div class="mt-2 ml-4 space-y-1">
<a href="#" class="flex items-center px-3 py-2 text-sm text-gray-600 hover:text-gray-900 rounded-md hover:bg-gray-50">
<i class="ri-pulse-line mr-2"></i>
模型生命周期
</a>
<a href="#" class="flex items-center px-3 py-2 text-sm text-gray-600 hover:text-gray-900 rounded-md hover:bg-gray-50">
<i class="ri-bar-chart-line mr-2"></i>
模型性能评估
</a>
<a href="https://readdy.ai/home/42b69b4b-e314-4f8d-9e2f-98a4952face1/1aa2c0c3-fdb6-405e-80c6-bf8d328e590e" data-readdy="true" class="flex items-center px-3 py-2 text-sm text-primary bg-blue-50 rounded-md">
<i class="ri-loop-left-line mr-2"></i>
模型转换适配
</a>
</div>
</div>
<!-- 推理服务 -->
<div>
<div class="flex items-center px-3 py-2 text-gray-700 font-medium rounded-md hover:bg-gray-50">
<i class="ri-cpu-line mr-2"></i>
<span>推理服务</span>
</div>
</div>
<!-- API 接口 -->
<div>
<div class="flex items-center px-3 py-2 text-gray-700 font-medium rounded-md hover:bg-gray-50">
<i class="ri-code-line mr-2"></i>
<span>API 接口</span>
</div>
</div>
<!-- 数据处理 -->
<div>
<div class="flex items-center px-3 py-2 text-gray-700 font-medium rounded-md hover:bg-gray-50">
<i class="ri-file-list-3-line mr-2"></i>
<span>数据处理</span>
</div>
</div>
</div>
</nav>
</aside>

<!-- 主要内容区域 -->
<div class="flex-1 flex flex-col overflow-hidden">
<!-- 顶部导航栏 -->
<header class="bg-white shadow-sm">
<div class="flex items-center justify-between px-6 py-3">
<div class="flex items-center space-x-4">
<a href="https://readdy.ai/home/42b69b4b-e314-4f8d-9e2f-98a4952face1/1aa2c0c3-fdb6-405e-80c6-bf8d328e590e" data-readdy="true" class="flex items-center text-gray-600 hover:text-primary">
<div class="w-8 h-8 flex items-center justify-center rounded-full bg-gray-100 hover:bg-blue-50 mr-2">
<i class="ri-arrow-left-line"></i>
</div>
<span class="text-sm font-medium">返回转换管理</span>
</a>
<div class="relative">
<input type="text" placeholder="搜索格式..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-button text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
<div class="absolute left-3 top-2.5 w-4 h-4 flex items-center justify-center text-gray-400">
<i class="ri-search-line"></i>
</div>
</div>
</div>
<div class="flex items-center space-x-4">
<div class="w-8 h-8 flex items-center justify-center rounded-full bg-blue-50 text-primary">
<i class="ri-notification-3-line"></i>
</div>
<div class="w-8 h-8 flex items-center justify-center rounded-full bg-blue-50 text-primary">
<i class="ri-settings-3-line"></i>
</div>
<div class="flex items-center">
<img src="https://readdy.ai/api/search-image?query=professional%20headshot%20of%20a%20young%20asian%20man%20with%20short%20black%20hair%2C%20business%20casual%20attire%2C%20neutral%20background%2C%20high%20quality%20portrait&width=80&height=80&seq=1&orientation=squarish" alt="用户头像" class="w-8 h-8 rounded-full object-cover">
<span class="ml-2 text-sm font-medium text-gray-700">陈思远</span>
</div>
</div>
</div>
</header>

<!-- 主要内容区域 -->
<main class="flex-1 overflow-y-auto px-6 py-8">
<!-- 面包屑导航 -->
<div class="flex items-center text-sm text-gray-500 mb-6">
<a href="#" class="hover:text-primary">首页</a>
<span class="mx-2">/</span>
<a href="#" class="hover:text-primary">模型管理</a>
<span class="mx-2">/</span>
<a href="https://readdy.ai/home/42b69b4b-e314-4f8d-9e2f-98a4952face1/1aa2c0c3-fdb6-405e-80c6-bf8d328e590e" data-readdy="true" class="hover:text-primary">模型转换适配</a>
<span class="mx-2">/</span>
<span class="text-gray-700">目标格式详情</span>
</div>

<!-- 页面标题 -->
<div class="flex justify-between items-center mb-8">
<div>
<h1 class="text-2xl font-bold text-gray-900">支持的目标格式</h1>
<p class="text-gray-600 mt-1">完整的格式列表、详细说明、适用场景和性能对比</p>
</div>
<div class="flex space-x-3">
<button class="flex items-center px-4 py-2 bg-white border border-gray-300 rounded-button text-sm font-medium text-gray-700 hover:bg-gray-50 whitespace-nowrap !rounded-button">
<div class="w-4 h-4 flex items-center justify-center mr-2">
<i class="ri-download-line"></i>
</div>
导出格式列表
</button>
<button class="flex items-center px-4 py-2 bg-primary text-white rounded-button text-sm font-medium hover:bg-blue-600 whitespace-nowrap !rounded-button">
<div class="w-4 h-4 flex items-center justify-center mr-2">
<i class="ri-compare-line"></i>
</div>
格式对比工具
</button>
</div>
</div>

<!-- 格式筛选和搜索 -->
<div class="bg-white rounded-lg shadow-sm p-6 mb-8">
<div class="flex flex-wrap items-center justify-between gap-4">
<div class="flex items-center space-x-4">
<div class="flex items-center space-x-2">
<span class="text-sm font-medium text-gray-700">筛选:</span>
<button class="filter-btn px-3 py-1.5 text-xs font-medium rounded-full bg-primary text-white" data-filter="all">全部</button>
<button class="filter-btn px-3 py-1.5 text-xs font-medium rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200" data-filter="inference">推理优化</button>
<button class="filter-btn px-3 py-1.5 text-xs font-medium rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200" data-filter="mobile">移动端</button>
<button class="filter-btn px-3 py-1.5 text-xs font-medium rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200" data-filter="web">Web 端</button>
<button class="filter-btn px-3 py-1.5 text-xs font-medium rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200" data-filter="edge">边缘设备</button>
</div>
</div>
<div class="flex items-center space-x-3">
<select class="pl-3 pr-8 py-2 border border-gray-300 rounded-button text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent appearance-none bg-white">
<option>按性能排序</option>
<option>按文件大小排序</option>
<option>按兼容性排序</option>
<option>按推理速度排序</option>
</select>
<div class="flex items-center border border-gray-300 rounded-button">
<button class="view-btn p-2 text-gray-600 hover:text-primary hover:bg-gray-50" data-view="grid">
<div class="w-4 h-4 flex items-center justify-center">
<i class="ri-grid-line"></i>
</div>
</button>
<button class="view-btn p-2 text-primary bg-blue-50" data-view="list">
<div class="w-4 h-4 flex items-center justify-center">
<i class="ri-list-check"></i>
</div>
</button>
</div>
</div>
</div>
</div>

<!-- 格式概览统计 -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500">支持格式总数</p>
<p class="text-2xl font-bold text-gray-900 mt-1">12</p>
</div>
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-blue-50 text-primary">
<i class="ri-file-code-line ri-lg"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-3">涵盖主流推理框架</p>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500">推理优化格式</p>
<p class="text-2xl font-bold text-gray-900 mt-1">8</p>
</div>
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-green-50 text-green-500">
<i class="ri-speed-line ri-lg"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-3">专为性能优化设计</p>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500">移动端支持</p>
<p class="text-2xl font-bold text-gray-900 mt-1">5</p>
</div>
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-purple-50 text-purple-500">
<i class="ri-smartphone-line ri-lg"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-3">适配移动设备部署</p>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500">跨平台格式</p>
<p class="text-2xl font-bold text-gray-900 mt-1">3</p>
</div>
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-orange-50 text-orange-500">
<i class="ri-global-line ri-lg"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-3">支持多平台部署</p>
</div>
</div>

<!-- 主要内容区域 - Tab 切换 -->
<div class="bg-white rounded-lg shadow-sm">
<div class="flex border-b border-gray-100">
<button class="tab-button px-6 py-4 text-sm font-medium tab-active" data-tab="formats">格式列表</button>
<button class="tab-button px-6 py-4 text-sm font-medium text-gray-500 hover:text-gray-700" data-tab="scenarios">适用场景</button>
<button class="tab-button px-6 py-4 text-sm font-medium text-gray-500 hover:text-gray-700" data-tab="examples">转换示例</button>
<button class="tab-button px-6 py-4 text-sm font-medium text-gray-500 hover:text-gray-700" data-tab="performance">性能对比</button>
<button class="tab-button px-6 py-4 text-sm font-medium text-gray-500 hover:text-gray-700" data-tab="comparison">格式对比</button>
</div>

<!-- 格式列表 Tab -->
<div id="formats" class="tab-content active p-6">
<div id="formatGrid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- ONNX -->
<div class="format-card bg-white border border-gray-200 rounded-lg p-6" data-category="inference">
<div class="flex items-start justify-between mb-4">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center rounded-lg bg-blue-50 text-primary mr-4">
<i class="ri-file-code-line ri-xl"></i>
</div>
<div>
<h3 class="text-lg font-semibold text-gray-900">ONNX</h3>
<p class="text-sm text-gray-500">Open Neural Network Exchange</p>
</div>
</div>
<span class="px-2 py-1 text-xs font-medium text-blue-700 bg-blue-100 rounded-full">通用</span>
</div>
<div class="space-y-3 mb-4">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">文件扩展名</span>
<span class="text-sm font-medium text-gray-800">.onnx</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">当前版本</span>
<span class="text-sm font-medium text-gray-800">1.15.0</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">Opset 版本</span>
<span class="text-sm font-medium text-gray-800">18</span>
</div>
</div>
<p class="text-sm text-gray-600 mb-4">开放式神经网络交换格式，支持跨框架模型部署，具有良好的兼容性和标准化程度。</p>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="w-3 h-3 bg-green-500 rounded-full"></div>
<span class="text-xs text-gray-600">高兼容性</span>
</div>
<button class="text-primary text-sm hover:text-blue-600 font-medium">查看详情</button>
</div>
</div>

<!-- TensorRT -->
<div class="format-card bg-white border border-gray-200 rounded-lg p-6" data-category="inference">
<div class="flex items-start justify-between mb-4">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center rounded-lg bg-green-50 text-green-500 mr-4">
<i class="ri-file-code-line ri-xl"></i>
</div>
<div>
<h3 class="text-lg font-semibold text-gray-900">TensorRT</h3>
<p class="text-sm text-gray-500">NVIDIA GPU 优化</p>
</div>
</div>
<span class="px-2 py-1 text-xs font-medium text-green-700 bg-green-100 rounded-full">GPU</span>
</div>
<div class="space-y-3 mb-4">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">文件扩展名</span>
<span class="text-sm font-medium text-gray-800">.trt, .engine</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">当前版本</span>
<span class="text-sm font-medium text-gray-800">8.6.1</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">CUDA 版本</span>
<span class="text-sm font-medium text-gray-800">11.8+</span>
</div>
</div>
<p class="text-sm text-gray-600 mb-4">NVIDIA 推理优化库，专为 GPU 推理性能优化，支持 FP16、INT8 量化，推理速度极快。</p>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="w-3 h-3 bg-green-500 rounded-full"></div>
<span class="text-xs text-gray-600">极速推理</span>
</div>
<button class="text-primary text-sm hover:text-blue-600 font-medium">查看详情</button>
</div>
</div>

<!-- TensorFlow Lite -->
<div class="format-card bg-white border border-gray-200 rounded-lg p-6" data-category="mobile">
<div class="flex items-start justify-between mb-4">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center rounded-lg bg-purple-50 text-purple-500 mr-4">
<i class="ri-file-code-line ri-xl"></i>
</div>
<div>
<h3 class="text-lg font-semibold text-gray-900">TensorFlow Lite</h3>
<p class="text-sm text-gray-500">移动端优化</p>
</div>
</div>
<span class="px-2 py-1 text-xs font-medium text-purple-700 bg-purple-100 rounded-full">移动端</span>
</div>
<div class="space-y-3 mb-4">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">文件扩展名</span>
<span class="text-sm font-medium text-gray-800">.tflite</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">当前版本</span>
<span class="text-sm font-medium text-gray-800">2.13.0</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">量化支持</span>
<span class="text-sm font-medium text-gray-800">INT8, FP16</span>
</div>
</div>
<p class="text-sm text-gray-600 mb-4">专为移动设备和嵌入式设备设计的轻量级推理框架，模型体积小，推理效率高。</p>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="w-3 h-3 bg-purple-500 rounded-full"></div>
<span class="text-xs text-gray-600">轻量级</span>
</div>
<button class="text-primary text-sm hover:text-blue-600 font-medium">查看详情</button>
</div>
</div>

<!-- OpenVINO -->
<div class="format-card bg-white border border-gray-200 rounded-lg p-6" data-category="inference edge">
<div class="flex items-start justify-between mb-4">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center rounded-lg bg-orange-50 text-orange-500 mr-4">
<i class="ri-file-code-line ri-xl"></i>
</div>
<div>
<h3 class="text-lg font-semibold text-gray-900">OpenVINO</h3>
<p class="text-sm text-gray-500">Intel 优化</p>
</div>
</div>
<span class="px-2 py-1 text-xs font-medium text-orange-700 bg-orange-100 rounded-full">CPU</span>
</div>
<div class="space-y-3 mb-4">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">文件扩展名</span>
<span class="text-sm font-medium text-gray-800">.xml, .bin</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">当前版本</span>
<span class="text-sm font-medium text-gray-800">2023.1</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">支持硬件</span>
<span class="text-sm font-medium text-gray-800">CPU, GPU, VPU</span>
</div>
</div>
<p class="text-sm text-gray-600 mb-4">Intel 开发的推理优化工具包，专为 Intel 硬件优化，支持 CPU、GPU 和 VPU 加速。</p>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="w-3 h-3 bg-orange-500 rounded-full"></div>
<span class="text-xs text-gray-600">Intel 优化</span>
</div>
<button class="text-primary text-sm hover:text-blue-600 font-medium">查看详情</button>
</div>
</div>

<!-- TorchScript -->
<div class="format-card bg-white border border-gray-200 rounded-lg p-6" data-category="inference">
<div class="flex items-start justify-between mb-4">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center rounded-lg bg-red-50 text-red-500 mr-4">
<i class="ri-file-code-line ri-xl"></i>
</div>
<div>
<h3 class="text-lg font-semibold text-gray-900">TorchScript</h3>
<p class="text-sm text-gray-500">PyTorch 序列化</p>
</div>
</div>
<span class="px-2 py-1 text-xs font-medium text-red-700 bg-red-100 rounded-full">生产</span>
</div>
<div class="space-y-3 mb-4">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">文件扩展名</span>
<span class="text-sm font-medium text-gray-800">.pt, .pth</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">PyTorch 版本</span>
<span class="text-sm font-medium text-gray-800">1.9.0+</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">JIT 编译</span>
<span class="text-sm font-medium text-gray-800">支持</span>
</div>
</div>
<p class="text-sm text-gray-600 mb-4">PyTorch 的序列化格式，支持 JIT 编译优化，适合生产环境部署，保持 PyTorch 生态兼容性。</p>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="w-3 h-3 bg-red-500 rounded-full"></div>
<span class="text-xs text-gray-600">PyTorch 原生</span>
</div>
<button class="text-primary text-sm hover:text-blue-600 font-medium">查看详情</button>
</div>
</div>

<!-- TensorFlow.js -->
<div class="format-card bg-white border border-gray-200 rounded-lg p-6" data-category="web">
<div class="flex items-start justify-between mb-4">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center rounded-lg bg-yellow-50 text-yellow-500 mr-4">
<i class="ri-file-code-line ri-xl"></i>
</div>
<div>
<h3 class="text-lg font-semibold text-gray-900">TensorFlow.js</h3>
<p class="text-sm text-gray-500">浏览器运行</p>
</div>
</div>
<span class="px-2 py-1 text-xs font-medium text-yellow-700 bg-yellow-100 rounded-full">Web</span>
</div>
<div class="space-y-3 mb-4">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">文件格式</span>
<span class="text-sm font-medium text-gray-800">JSON + Bin</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">当前版本</span>
<span class="text-sm font-medium text-gray-800">4.10.0</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">WebGL 加速</span>
<span class="text-sm font-medium text-gray-800">支持</span>
</div>
</div>
<p class="text-sm text-gray-600 mb-4">在浏览器中运行的机器学习框架，支持 WebGL 加速，适合 Web 应用和客户端推理。</p>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="w-3 h-3 bg-yellow-500 rounded-full"></div>
<span class="text-xs text-gray-600">浏览器原生</span>
</div>
<button class="text-primary text-sm hover:text-blue-600 font-medium">查看详情</button>
</div>
</div>
</div>
</div>

<!-- 适用场景 Tab -->
<div id="scenarios" class="tab-content p-6">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div class="space-y-6">
<h3 class="text-lg font-semibold text-gray-900">按部署环境分类</h3>

<!-- 服务器端推理 -->
<div class="bg-gray-50 rounded-lg p-6">
<div class="flex items-center mb-4">
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-blue-50 text-primary mr-3">
<i class="ri-server-line ri-lg"></i>
</div>
<h4 class="text-base font-medium text-gray-900">服务器端推理</h4>
</div>
<div class="space-y-3">
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-blue-50 text-primary mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">ONNX</span>
</div>
<span class="text-xs text-gray-500">通用兼容，易于部署</span>
</div>
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-green-50 text-green-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">TensorRT</span>
</div>
<span class="text-xs text-gray-500">GPU 加速，极速推理</span>
</div>
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-red-50 text-red-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">TorchScript</span>
</div>
<span class="text-xs text-gray-500">PyTorch 生态，生产就绪</span>
</div>
</div>
</div>

<!-- 移动端部署 -->
<div class="bg-gray-50 rounded-lg p-6">
<div class="flex items-center mb-4">
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-purple-50 text-purple-500 mr-3">
<i class="ri-smartphone-line ri-lg"></i>
</div>
<h4 class="text-base font-medium text-gray-900">移动端部署</h4>
</div>
<div class="space-y-3">
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-purple-50 text-purple-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">TensorFlow Lite</span>
</div>
<span class="text-xs text-gray-500">Android/iOS 优化</span>
</div>
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-gray-50 text-gray-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">Core ML</span>
</div>
<span class="text-xs text-gray-500">iOS 原生支持</span>
</div>
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-blue-50 text-primary mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">ONNX Runtime Mobile</span>
</div>
<span class="text-xs text-gray-500">跨平台移动推理</span>
</div>
</div>
</div>

<!-- Web 浏览器 -->
<div class="bg-gray-50 rounded-lg p-6">
<div class="flex items-center mb-4">
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-yellow-50 text-yellow-500 mr-3">
<i class="ri-global-line ri-lg"></i>
</div>
<h4 class="text-base font-medium text-gray-900">Web 浏览器</h4>
</div>
<div class="space-y-3">
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-yellow-50 text-yellow-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">TensorFlow.js</span>
</div>
<span class="text-xs text-gray-500">浏览器原生运行</span>
</div>
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-blue-50 text-primary mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">ONNX.js</span>
</div>
<span class="text-xs text-gray-500">Web 端 ONNX 运行时</span>
</div>
<div class="flex items-center justify-between p-3 bg-white rounded border">
<div class="flex items-center">
<div class="w-6 h-6 flex items-center justify-center rounded bg-green-50 text-green-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">WebNN</span>
</div>
<span class="text-xs text-gray-500">Web 神经网络 API</span>
</div>
</div>
</div>
</div>

<div class="space-y-6">
<h3 class="text-lg font-semibold text-gray-900">按应用场景分类</h3>

<!-- 实时推理 -->
<div class="bg-gray-50 rounded-lg p-6">
<div class="flex items-center mb-4">
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-green-50 text-green-500 mr-3">
<i class="ri-speed-line ri-lg"></i>
</div>
<h4 class="text-base font-medium text-gray-900">实时推理</h4>
</div>
<p class="text-sm text-gray-600 mb-4">要求低延迟、高吞吐量的应用场景</p>
<div class="space-y-2">
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-green-500 rounded-full mr-2"></div>
<span class="text-gray-700">TensorRT (GPU 加速)</span>
</div>
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-green-500 rounded-full mr-2"></div>
<span class="text-gray-700">OpenVINO (Intel 硬件)</span>
</div>
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-green-500 rounded-full mr-2"></div>
<span class="text-gray-700">TensorFlow Lite (移动端)</span>
</div>
</div>
</div>

<!-- 批量处理 -->
<div class="bg-gray-50 rounded-lg p-6">
<div class="flex items-center mb-4">
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-orange-50 text-orange-500 mr-3">
<i class="ri-database-line ri-lg"></i>
</div>
<h4 class="text-base font-medium text-gray-900">批量处理</h4>
</div>
<p class="text-sm text-gray-600 mb-4">大规模数据处理，注重吞吐量</p>
<div class="space-y-2">
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-orange-500 rounded-full mr-2"></div>
<span class="text-gray-700">ONNX (通用兼容)</span>
</div>
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-orange-500 rounded-full mr-2"></div>
<span class="text-gray-700">TorchScript (PyTorch 生态)</span>
</div>
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-orange-500 rounded-full mr-2"></div>
<span class="text-gray-700">TensorRT (大批量 GPU)</span>
</div>
</div>
</div>

<!-- 边缘计算 -->
<div class="bg-gray-50 rounded-lg p-6">
<div class="flex items-center mb-4">
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-purple-50 text-purple-500 mr-3">
<i class="ri-cpu-line ri-lg"></i>
</div>
<h4 class="text-base font-medium text-gray-900">边缘计算</h4>
</div>
<p class="text-sm text-gray-600 mb-4">资源受限环境，离线运行</p>
<div class="space-y-2">
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-purple-500 rounded-full mr-2"></div>
<span class="text-gray-700">TensorFlow Lite (嵌入式)</span>
</div>
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-purple-500 rounded-full mr-2"></div>
<span class="text-gray-700">OpenVINO (边缘设备)</span>
</div>
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-purple-500 rounded-full mr-2"></div>
<span class="text-gray-700">ONNX Runtime (轻量级)</span>
</div>
</div>
</div>

<!-- 云端部署 -->
<div class="bg-gray-50 rounded-lg p-6">
<div class="flex items-center mb-4">
<div class="w-10 h-10 flex items-center justify-center rounded-lg bg-blue-50 text-primary mr-3">
<i class="ri-cloud-line ri-lg"></i>
</div>
<h4 class="text-base font-medium text-gray-900">云端部署</h4>
</div>
<p class="text-sm text-gray-600 mb-4">弹性扩展，多租户服务</p>
<div class="space-y-2">
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-blue-500 rounded-full mr-2"></div>
<span class="text-gray-700">ONNX (标准化)</span>
</div>
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-blue-500 rounded-full mr-2"></div>
<span class="text-gray-700">TensorRT (GPU 集群)</span>
</div>
<div class="flex items-center text-sm">
<div class="w-2 h-2 bg-blue-500 rounded-full mr-2"></div>
<span class="text-gray-700">TorchScript (容器化)</span>
</div>
</div>
</div>
</div>
</div>
</div>

<!-- 转换示例 Tab -->
<div id="examples" class="tab-content p-6">
<div class="space-y-8">
<div class="flex justify-between items-center">
<h3 class="text-lg font-semibold text-gray-900">转换示例代码</h3>
<select id="exampleSelect" class="pl-3 pr-8 py-2 border border-gray-300 rounded-button text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent appearance-none bg-white">
<option value="pytorch-onnx">PyTorch → ONNX</option>
<option value="tensorflow-trt">TensorFlow → TensorRT</option>
<option value="onnx-openvino">ONNX → OpenVINO</option>
<option value="keras-tflite">Keras → TensorFlow Lite</option>
<option value="pytorch-torchscript">PyTorch → TorchScript</option>
<option value="tensorflow-tfjs">TensorFlow → TensorFlow.js</option>
</select>
</div>

<!-- PyTorch to ONNX 示例 -->
<div id="pytorch-onnx-example" class="example-content">
<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">PyTorch 模型转换为 ONNX</h4>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div>
<h5 class="text-sm font-medium text-gray-700 mb-3">基础转换</h5>
<div class="relative">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">复制</button>
<pre><code>import torch
import torch.onnx

# 加载 PyTorch 模型
model = torch.load('model.pth')
model.eval()

# 创建示例输入
dummy_input = torch.randn(1, 3, 224, 224)

# 转换为 ONNX
torch.onnx.export(
    model,
    dummy_input,
    'model.onnx',
    export_params=True,
    opset_version=15,
    do_constant_folding=True,
    input_names=['input'],
    output_names=['output'],
    dynamic_axes={
        'input': {0: 'batch_size'},
        'output': {0: 'batch_size'}
    }
)</code></pre>
</div>
</div>
</div>
<div>
<h5 class="text-sm font-medium text-gray-700 mb-3">高级配置</h5>
<div class="relative">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">复制</button>
<pre><code># 带验证的转换
import onnx
import onnxruntime as ort

# 验证 ONNX 模型
onnx_model = onnx.load('model.onnx')
onnx.checker.check_model(onnx_model)

# 创建推理会话
ort_session = ort.InferenceSession('model.onnx')

# 测试推理
input_data = dummy_input.numpy()
outputs = ort_session.run(
    None, 
    {'input': input_data}
)

print(f"ONNX 输出形状: {outputs[0].shape}")

# 优化模型
from onnxruntime.tools import optimizer
optimized_model = optimizer.optimize_model(
    'model.onnx',
    model_type='bert',  # 或其他模型类型
    num_heads=12,
    hidden_size=768
)</code></pre>
</div>
</div>
</div>
</div>
<div class="mt-6 p-4 bg-blue-50 rounded-lg">
<h6 class="text-sm font-medium text-blue-800 mb-2">转换要点</h6>
<ul class="text-sm text-blue-700 space-y-1">
<li>• 确保模型处于评估模式 (model.eval())</li>
<li>• 选择合适的 opset 版本以获得最佳兼容性</li>
<li>• 使用动态轴支持不同批次大小</li>
<li>• 转换后验证模型正确性</li>
</ul>
</div>
</div>
</div>

<!-- TensorFlow to TensorRT 示例 -->
<div id="tensorflow-trt-example" class="example-content hidden">
<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">TensorFlow 模型转换为 TensorRT</h4>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div>
<h5 class="text-sm font-medium text-gray-700 mb-3">使用 TensorRT</h5>
<div class="relative">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">复制</button>
<pre><code>import tensorflow as tf
from tensorflow.python.compiler.tensorrt import trt_convert as trt

# 加载 SavedModel
saved_model_dir = 'path/to/saved_model'

# 创建 TensorRT 转换器
converter = trt.TrtGraphConverterV2(
    input_saved_model_dir=saved_model_dir,
    precision_mode=trt.TrtPrecisionMode.FP16,
    maximum_cached_engines=1
)

# 执行转换
converter.convert()

# 保存优化后的模型
output_saved_model_dir = 'path/to/trt_model'
converter.save(output_saved_model_dir)

print("TensorRT 转换完成")</code></pre>
</div>
</div>
</div>
<div>
<h5 class="text-sm font-medium text-gray-700 mb-3">校准和量化</h5>
<div class="relative">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">复制</button>
<pre><code># INT8 量化转换
def calibration_input_fn():
    # 提供校准数据
    for i in range(100):
        yield [np.random.random((1, 224, 224, 3))]

converter = trt.TrtGraphConverterV2(
    input_saved_model_dir=saved_model_dir,
    precision_mode=trt.TrtPrecisionMode.INT8,
    use_calibration=True
)

# 构建校准引擎
converter.convert(calibration_input_fn=calibration_input_fn)

# 推理测试
import numpy as np

model = tf.saved_model.load(output_saved_model_dir)
infer = model.signatures['serving_default']

input_data = tf.constant(np.random.random((1, 224, 224, 3)), dtype=tf.float32)
output = infer(input_data)
print(f"TensorRT 输出: {output}")</code></pre>
</div>
</div>
</div>
</div>
<div class="mt-6 p-4 bg-green-50 rounded-lg">
<h6 class="text-sm font-medium text-green-800 mb-2">优化建议</h6>
<ul class="text-sm text-green-700 space-y-1">
<li>• FP16 精度可获得 2x 性能提升</li>
<li>• INT8 量化需要校准数据集</li>
<li>• 确保 CUDA 和 TensorRT 版本兼容</li>
<li>• 测试不同批次大小的性能</li>
</ul>
</div>
</div>
</div>

<!-- 其他转换示例 -->
<div id="onnx-openvino-example" class="example-content hidden">
<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">ONNX 模型转换为 OpenVINO</h4>
<div class="relative">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">复制</button>
<pre><code># 使用 OpenVINO Model Optimizer
from openvino.tools import mo

# 转换 ONNX 模型
model = mo.convert_model('model.onnx')

# 编译模型
import openvino.runtime as ov
core = ov.Core()
compiled_model = core.compile_model(model, 'CPU')

# 推理
input_layer = compiled_model.input(0)
output_layer = compiled_model.output(0)

infer_request = compiled_model.create_infer_request()
infer_request.infer({input_layer: input_data})
result = infer_request.get_output_tensor(0).data</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>

<!-- 性能对比 Tab -->
<div id="performance" class="tab-content p-6">
<div class="space-y-8">
<div class="flex justify-between items-center">
<h3 class="text-lg font-semibold text-gray-900">性能对比分析</h3>
<div class="flex items-center space-x-3">
<select class="pl-3 pr-8 py-2 border border-gray-300 rounded-button text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent appearance-none bg-white">
<option>ResNet-50</option>
<option>BERT-Base</option>
<option>YOLOv5</option>
<option>MobileNet v2</option>
</select>
<select class="pl-3 pr-8 py-2 border border-gray-300 rounded-button text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent appearance-none bg-white">
<option>NVIDIA T4</option>
<option>Intel Xeon</option>
<option>ARM Cortex-A78</option>
</select>
</div>
</div>

<!-- 性能图表 -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">推理延迟对比 (ms)</h4>
<div id="latencyChart" class="h-64"></div>
</div>
<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">吞吐量对比 (样本/秒)</h4>
<div id="throughputChart" class="h-64"></div>
</div>
</div>

<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">内存占用对比 (MB)</h4>
<div id="memoryChart" class="h-64"></div>
</div>

<!-- 详细性能表格 -->
<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">详细性能数据</h4>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">格式</th>
<th class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">推理延迟 (ms)</th>
<th class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">吞吐量 (样本/秒)</th>
<th class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">内存占用 (MB)</th>
<th class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">模型大小 (MB)</th>
<th class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">精度保持</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center rounded bg-blue-50 text-primary mr-3">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-900">ONNX</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">18.5</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">54.1</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">720</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">98.2</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 text-center">99.9%</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center rounded bg-green-50 text-green-500 mr-3">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-900">TensorRT</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">8.2</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">122.0</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">890</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">102.5</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 text-center">99.7%</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center rounded bg-purple-50 text-purple-500 mr-3">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-900">TensorFlow Lite</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">25.3</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">39.5</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">450</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">25.8</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 text-center">99.5%</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center rounded bg-orange-50 text-orange-500 mr-3">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-900">OpenVINO</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">12.4</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">80.6</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">680</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">95.7</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 text-center">99.8%</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center rounded bg-red-50 text-red-500 mr-3">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-900">TorchScript</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">22.1</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">45.2</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">820</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">98.9</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 text-center">100.0%</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center rounded bg-yellow-50 text-yellow-500 mr-3">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-900">TensorFlow.js</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">45.7</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">21.9</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">520</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">32.4</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 text-center">99.3%</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

<!-- 格式对比 Tab -->
<div id="comparison" class="tab-content p-6">
<div class="space-y-6">
<div class="flex justify-between items-center">
<h3 class="text-lg font-semibold text-gray-900">格式对比工具</h3>
<button class="px-4 py-2 bg-primary text-white rounded-button text-sm font-medium hover:bg-blue-600 whitespace-nowrap !rounded-button">
导出对比报告
</button>
</div>

<!-- 格式选择器 -->
<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">选择要对比的格式</h4>
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4">
<label class="comparison-card cursor-pointer">
<div class="custom-checkbox">
<input type="checkbox" name="compareFormat" value="onnx" checked>
<span class="checkmark"></span>
</div>
<div class="flex items-center p-3 border border-gray-200 rounded-lg hover:border-primary">
<div class="w-8 h-8 flex items-center justify-center rounded bg-blue-50 text-primary mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">ONNX</span>
</div>
</label>
<label class="comparison-card cursor-pointer">
<div class="custom-checkbox">
<input type="checkbox" name="compareFormat" value="tensorrt" checked>
<span class="checkmark"></span>
</div>
<div class="flex items-center p-3 border border-gray-200 rounded-lg hover:border-primary">
<div class="w-8 h-8 flex items-center justify-center rounded bg-green-50 text-green-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">TensorRT</span>
</div>
</label>
<label class="comparison-card cursor-pointer">
<div class="custom-checkbox">
<input type="checkbox" name="compareFormat" value="tflite">
<span class="checkmark"></span>
</div>
<div class="flex items-center p-3 border border-gray-200 rounded-lg hover:border-primary">
<div class="w-8 h-8 flex items-center justify-center rounded bg-purple-50 text-purple-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">TF Lite</span>
</div>
</label>
<label class="comparison-card cursor-pointer">
<div class="custom-checkbox">
<input type="checkbox" name="compareFormat" value="openvino">
<span class="checkmark"></span>
</div>
<div class="flex items-center p-3 border border-gray-200 rounded-lg hover:border-primary">
<div class="w-8 h-8 flex items-center justify-center rounded bg-orange-50 text-orange-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">OpenVINO</span>
</div>
</label>
<label class="comparison-card cursor-pointer">
<div class="custom-checkbox">
<input type="checkbox" name="compareFormat" value="torchscript">
<span class="checkmark"></span>
</div>
<div class="flex items-center p-3 border border-gray-200 rounded-lg hover:border-primary">
<div class="w-8 h-8 flex items-center justify-center rounded bg-red-50 text-red-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">TorchScript</span>
</div>
</label>
<label class="comparison-card cursor-pointer">
<div class="custom-checkbox">
<input type="checkbox" name="compareFormat" value="tfjs">
<span class="checkmark"></span>
</div>
<div class="flex items-center p-3 border border-gray-200 rounded-lg hover:border-primary">
<div class="w-8 h-8 flex items-center justify-center rounded bg-yellow-50 text-yellow-500 mr-2">
<i class="ri-file-code-line"></i>
</div>
<span class="text-sm font-medium text-gray-800">TF.js</span>
</div>
</label>
</div>
</div>

<!-- 对比结果 -->
<div class="bg-white border border-gray-200 rounded-lg p-6">
<h4 class="text-base font-medium text-gray-900 mb-4">对比结果</h4>
<div id="comparisonChart" class="h-80 mb-6"></div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div>
<h5 class="text-sm font-medium text-gray-700 mb-3">优势对比</h5>
<div class="space-y-3">
<div class="flex items-center justify-between p-3 bg-blue-50 rounded">
<span class="text-sm font-medium text-blue-800">ONNX</span>
<span class="text-xs text-blue-600">跨平台兼容性最佳</span>
</div>
<div class="flex items-center justify-between p-3 bg-green-50 rounded">
<span class="text-sm font-medium text-green-800">TensorRT</span>
<span class="text-xs text-green-600">GPU 推理性能最优</span>
</div>
</div>
</div>
<div>
<h5 class="text-sm font-medium text-gray-700 mb-3">适用场景</h5>
<div class="space-y-3">
<div class="flex items-center justify-between p-3 bg-gray-50 rounded">
<span class="text-sm font-medium text-gray-800">云端部署</span>
<span class="text-xs text-gray-600">ONNX, TensorRT</span>
</div>
<div class="flex items-center justify-between p-3 bg-gray-50 rounded">
<span class="text-sm font-medium text-gray-800">移动端</span>
<span class="text-xs text-gray-600">TensorFlow Lite</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>

<script id="tabSwitching">
document.addEventListener('DOMContentLoaded', function() {
const tabButtons = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');

tabButtons.forEach(button => {
button.addEventListener('click', function() {
const tabName = this.getAttribute('data-tab');

// 移除所有 tab 的激活状态
tabButtons.forEach(btn => {
btn.classList.remove('tab-active', 'text-primary');
btn.classList.add('text-gray-500');
});

// 激活当前 tab
this.classList.add('tab-active', 'text-primary');
this.classList.remove('text-gray-500');

// 隐藏所有 tab 内容
tabContents.forEach(content => {
content.classList.remove('active');
});

// 显示当前 tab 内容
document.getElementById(tabName).classList.add('active');
});
});
});
</script>

<script id="filterAndSearch">
document.addEventListener('DOMContentLoaded', function() {
const filterButtons = document.querySelectorAll('.filter-btn');
const formatCards = document.querySelectorAll('.format-card');
const searchInput = document.querySelector('input[placeholder="搜索格式..."]');

// 筛选功能
filterButtons.forEach(button => {
button.addEventListener('click', function() {
const filter = this.getAttribute('data-filter');

// 更新按钮状态
filterButtons.forEach(btn => {
btn.classList.remove('bg-primary', 'text-white');
btn.classList.add('bg-gray-100', 'text-gray-600');
});
this.classList.remove('bg-gray-100', 'text-gray-600');
this.classList.add('bg-primary', 'text-white');

// 筛选卡片
formatCards.forEach(card => {
const categories = card.getAttribute('data-category') || '';
if (filter === 'all' || categories.includes(filter)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
});
});

// 搜索功能
if (searchInput) {
searchInput.addEventListener('input', function() {
const searchTerm = this.value.toLowerCase();
formatCards.forEach(card => {
const title = card.querySelector('h3').textContent.toLowerCase();
const description = card.querySelector('p').textContent.toLowerCase();
if (title.includes(searchTerm) || description.includes(searchTerm)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
});
}
});
</script>

<script id="exampleSwitching">
document.addEventListener('DOMContentLoaded', function() {
const exampleSelect = document.getElementById('exampleSelect');
const exampleContents = document.querySelectorAll('.example-content');

if (exampleSelect) {
exampleSelect.addEventListener('change', function() {
const selectedValue = this.value;
exampleContents.forEach(content => {
content.classList.add('hidden');
});
const targetContent = document.getElementById(selectedValue + '-example');
if (targetContent) {
targetContent.classList.remove('hidden');
}
});
}
});

function copyCode(button) {
const codeBlock = button.nextElementSibling.querySelector('code');
const text = codeBlock.textContent;
navigator.clipboard.writeText(text).then(() => {
button.textContent = '已复制';
setTimeout(() => {
button.textContent = '复制';
}, 2000);
});
}
</script>

<script id="chartInitialization">
document.addEventListener('DOMContentLoaded', function() {
// 延迟图表
const latencyChart = echarts.init(document.getElementById('latencyChart'));
const latencyOption = {
animation: false,
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(255, 255, 255, 0.8)',
borderColor: '#e2e8f0',
borderWidth: 1,
textStyle: { color: '#1f2937' }
},
grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
xAxis: {
type: 'category',
data: ['ONNX', 'TensorRT', 'TF Lite', 'OpenVINO', 'TorchScript', 'TF.js'],
axisLine: { lineStyle: { color: '#e2e8f0' } },
axisLabel: { color: '#1f2937' }
},
yAxis: {
type: 'value',
name: '延迟 (ms)',
axisLine: { show: false },
axisTick: { show: false },
splitLine: { lineStyle: { color: '#e2e8f0', type: 'dashed' } },
axisLabel: { color: '#1f2937' }
},
series: [{
data: [18.5, 8.2, 25.3, 12.4, 22.1, 45.7],
type: 'bar',
itemStyle: { color: 'rgba(87, 181, 231, 1)' },
label: { show: true, position: 'top', formatter: '{c} ms' }
}]
};
latencyChart.setOption(latencyOption);

// 吞吐量图表
const throughputChart = echarts.init(document.getElementById('throughputChart'));
const throughputOption = {
animation: false,
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(255, 255, 255, 0.8)',
borderColor: '#e2e8f0',
borderWidth: 1,
textStyle: { color: '#1f2937' }
},
grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
xAxis: {
type: 'category',
data: ['ONNX', 'TensorRT', 'TF Lite', 'OpenVINO', 'TorchScript', 'TF.js'],
axisLine: { lineStyle: { color: '#e2e8f0' } },
axisLabel: { color: '#1f2937' }
},
yAxis: {
type: 'value',
name: '吞吐量 (样本/秒)',
axisLine: { show: false },
axisTick: { show: false },
splitLine: { lineStyle: { color: '#e2e8f0', type: 'dashed' } },
axisLabel: { color: '#1f2937' }
},
series: [{
data: [54.1, 122.0, 39.5, 80.6, 45.2, 21.9],
type: 'bar',
itemStyle: { color: 'rgba(141, 211, 199, 1)' },
label: { show: true, position: 'top', formatter: '{c}' }
}]
};
throughputChart.setOption(throughputOption);

// 内存图表
const memoryChart = echarts.init(document.getElementById('memoryChart'));
const memoryOption = {
animation: false,
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(255, 255, 255, 0.8)',
borderColor: '#e2e8f0',
borderWidth: 1,
textStyle: { color: '#1f2937' }
},
grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
xAxis: {
type: 'category',
data: ['ONNX', 'TensorRT', 'TF Lite', 'OpenVINO', 'TorchScript', 'TF.js'],
axisLine: { lineStyle: { color: '#e2e8f0' } },
axisLabel: { color: '#1f2937' }
},
yAxis: {
type: 'value',
name: '内存占用 (MB)',
axisLine: { show: false },
axisTick: { show: false },
splitLine: { lineStyle: { color: '#e2e8f0', type: 'dashed' } },
axisLabel: { color: '#1f2937' }
},
series: [{
data: [720, 890, 450, 680, 820, 520],
type: 'bar',
itemStyle: { color: 'rgba(251, 191, 114, 1)' },
label: { show: true, position: 'top', formatter: '{c} MB' }
}]
};
memoryChart.setOption(memoryOption);

// 对比图表
const comparisonChart = echarts.init(document.getElementById('comparisonChart'));
const comparisonOption = {
animation: false,
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(255, 255, 255, 0.8)',
borderColor: '#e2e8f0',
borderWidth: 1,
textStyle: { color: '#1f2937' }
},
legend: {
data: ['推理延迟', '吞吐量', '内存效率', '模型大小'],
textStyle: { color: '#1f2937' }
},
radar: {
indicator: [
{ name: 'ONNX', max: 100 },
{ name: 'TensorRT', max: 100 },
{ name: 'TF Lite', max: 100 },
{ name: 'OpenVINO', max: 100 },
{ name: 'TorchScript', max: 100 },
{ name: 'TF.js', max: 100 }
],
radius: '65%',
axisName: { color: '#1f2937' },
splitLine: { lineStyle: { color: '#e2e8f0' } },
splitArea: { show: true, areaStyle: { color: ['#fff', '#f9fafb'] } },
axisLine: { lineStyle: { color: '#e2e8f0' } }
},
series: [{
name: '性能对比',
type: 'radar',
data: [
{
value: [85, 95, 75, 88, 82, 65],
name: '推理延迟',
areaStyle: { color: 'rgba(87, 181, 231, 0.1)' },
lineStyle: { color: 'rgba(87, 181, 231, 1)' },
itemStyle: { color: 'rgba(87, 181, 231, 1)' }
},
{
value: [75, 90, 65, 80, 70, 45],
name: '吞吐量',
areaStyle: { color: 'rgba(141, 211, 199, 0.1)' },
lineStyle: { color: 'rgba(141, 211, 199, 1)' },
itemStyle: { color: 'rgba(141, 211, 199, 1)' }
}
]
}]
};
comparisonChart.setOption(comparisonOption);

// 窗口大小变化时重新调整图表
window.addEventListener('resize', function() {
latencyChart.resize();
throughputChart.resize();
memoryChart.resize();
comparisonChart.resize();
});
});
</script>

</body>
</html>